<template>
	<sw-form-frame v-model="visible" :title="formName" width="560" :type="formType" :loading="btnLoading" footer @submit="handleSubmitForm()">
		<el-form ref="form" size="medium" :model="formData" :rules="formRules" label-width="80px" v-loading="loading">
			<el-form-item label="角色类型" prop="type">
				<el-radio-group v-model="formData.type" :aria-hidden="false">
					<el-radio v-for="(item, index) in dictData['ROLE_TYPE']" :key="index" :label="item.value">{{ item.msg }}</el-radio>
				</el-radio-group>
			</el-form-item>
			<el-form-item label="角色名称" prop="name">
				<el-input v-model="formData.name"></el-input>
			</el-form-item>
			<el-form-item label="角色描述">
				<el-input type="textarea" v-model="formData.content"></el-input>
			</el-form-item>
		</el-form>
	</sw-form-frame>
</template>

<script>
import formMixins from '@/mixins/formMixins';
import { queryRole, addedRole, updateRole } from '@/api/system/tbSysRole';
export default {
	mixins: [formMixins],
	enums: ['ROLE_TYPE'],
	data() {
		return {
			formName: '角色',
			formRules: {
				type: [{ required: true, message: '请选择角色类型', trigger: 'change' }],
				name: [{ required: true, message: '请输入角色名称', trigger: 'blur' }]
			}
		};
	},
	computed: {
		detailData() {
			return eval(queryRole);
		},
		callFunction() {
			return eval(this.addOrEdit ? addedRole : updateRole);
		}
	},
	methods: {}
};
</script>
